package memory

import (
	"booking-service/internal/models"
	"testing"
	"time"
)

func TestCreateOrder(t *testing.T) {
	storage := &InMemoryOrderStorage{}

	order := models.Order{
		HotelID:   "reddison",
		RoomID:    "lux",
		UserEmail: "guest@mail.ru",
		From:      time.Now(),
		To:        time.Now().Add(24 * time.Hour),
	}

	err := storage.CreateOrder(order)
	if err != nil {
		t.Errorf("expected no error, got %v", err)
	}

	orders := storage.GetOrders()
	if len(orders) != 1 {
		t.Errorf("expected 1 order, got %d", len(orders))
	}
}
